// Listing 16.2 The Employee Class an Driver Program
#include "MyString.hpp"
#include <cstring>
class Employee
{
    public:
        Employee();
        Employee(char*, char*, char*, long);
        ~Employee();
        Employee(const Employee&);
        Employee& operator=(const Employee&);

        const String& GetFirstNmae() const
        { return itsFirstName; }
        const String& GetLastName() const
        { return itsLastName; }
        const String& GetAddress() const
        { return itsAddress; }
        long GetSalary() const
        {
            return itsSalary;
        }

        void SetFirstName(const String& fName)
        { itsFirstName = fName; }
        void SetLastName(const String& lName)
        { itsLastName = lName; }
        void SetAddress(const String& address)
        { itsAddress = address; }
        void SetSalary(long salary) 
        { itsSalary = salary; }
    private:
        String itsFirstName;
        String itsLastName;
        String itsAddress;
        long itsSalary;
};

Employee::Employee():
    itsFirstName(""),
    itsLastName(""),
    itsAddress(""),
    itsSalary(0)
{}

Employee::Employee(char* firstName, char* lastName, char* address, long salary):
    itsFirstName(firstName),
    itsLastName(lastName),
    itsAddress(address),
    itsSalary(salary)
{}

Employee::Employee(const Employee& rhs):
    itsFirstName(rhs.GetFirstName()),
    itsLastName(rhs.GetLastName()),
    itsAddress(rhs.GetAddress()),
    itsSalary(rhs.GetSalary())
{}

Employee::~Employee(){}

Employee& Employee::operator=(const Employee& rhs)
{
    if(this == &rhs)
    {
        return *this;
    }
    
    itsFirstName = rhs.GetFirstName();
    itsLastName = rhs.GetLastName();
    itsAddress = rhs.GetAddress();
    itsSalary = rhs.GetSalary();
    return *this;
}

int main(void) 
{
    Employee Edie("Jane","Doe","1461 Shore Parkway",20000);
    Edie.SetSalary(5000);
    String LastName("Levine);
    Edie.SetLastName(LastName);
    Edie.SetFirstName("Edythe");

    cout << "Name: ";
    cou << Edie.GetFirstNmae().GetString();
    cout << " " << Edie.GetLastName().GetString();
    cout << ".\nAddress: ";
    cout << Edie.GetSalary();
    return 0;
}


